<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        include_once ('../includes/utilidades.php');
        include_once ('../includes/html.php');
        session_start();

        if (!isset($_REQUEST['filtro'])) {
            $filtro = '';
        } else {
            $filtro = $_REQUEST['filtro'];
        }
        
        print "<form name='f' action='atletas.php'>";
        print "<input type='text' name='filtro'>";
        print "<input type='submit' value='Aplicar'>";
        print "</form>";

        $actual = $_SERVER['REQUEST_SCHEME'] . "://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
        $_SESSION['afterUpdate']['atleta']=$actual;
        
        $sql = "select a.nombre, a.apellido1, a.apellido2,year(a.fechanacimiento) as anio, g.nombre as genero"
                . " from atleta a,genero g where a.idgenero=g.id"                
                . " and (a.nombre like '%" . $filtro . "%' or a.apellido1 like '%" . $filtro . "%' or a.apellido2 like '%" . $filtro . "%')";
        
        $atleta = select2($sql);
        
        $tAtleta=new HTML_Tabla($atleta);
        $tAtleta->setDisplayColumnNames(array('nombre'=>'Nombre','apellido1'=>'Apellido1','apellido2'=>'Apellido2','anio'=>'Año','genero'=>'Genero'));
        $tAtleta->toHTML();
        $tAtleta->printHTML();
        
        print "<div>";
        print "<p>Importar Atletas</p>";
        print "<form name=importarAtletas method=post enctype=\"multipart/form-data\" action=importarAtletas.php>";
        print "<input type=file name=fichero>";
        print "<input type=submit value=importar name=submit>";
        print "</form>";
        print "</div>"
        //toHTML('atleta', $atleta)
        ?>
    </body>
</html>
